<?php
/**
 * Created by PhpStorm.
 * User: xiaofeng
 * motto: 现在的努力是为了小时候吹过的牛逼！
 * Date: 2020/9/17
 * Time: 18:22
 */
namespace app\api\controller;
use app\common\business\Category as CategoryBis;
use app\common\lib\Arr;

class Category extends ApiBase {

    public function index(){
        // 获取所有分类的内容
        try{
            $categoryBusObj = new CategoryBis();
            $categorys = $categoryBusObj->getNormalAllCategorys();
        }catch (\Exception $e){
            // 加日志
            return show(config("status.success"),'内部异常k');
        }
        if (!$categorys){
            return show(config("status.success"),'数据为空');
        }
        $result = Arr::getTree($categorys);
        $result = Arr::sliceTreeArr($result);
       return show(config("status.success"),'ok',$result);
    }
}
